<?php
include_once 'module/conn.php';
include_once 'common/tools.php';

$matchId = $_GET["matchId"];

$config = require 'conf/config.ini.php';      //加载公用config.ini.php
$conn = mysql_connect($config["DB_HOST"], $config["DB_USER"], $config["DB_PWD"]);
mysql_select_db($config["DB_NAME"], $conn);
mysql_query("SET NAMES utf8");

$sql = "select * from live_team_stats_b where matchId = '" . $matchId . "'";
	
$statsList = mysql_query($sql, $conn);
if (mysql_num_rows($statsList) > 0) {
	while ($stats = mysql_fetch_object($statsList)) {
		$statsArray[] = $stats;
	}
	
	//启用一个带有ob_gzip压缩机的工作台
	ob_start('ob_gzip');
	
	echo '{"sql":"' . $sql . '","result":"Y","results":' . json_encode($statsArray) . '}';
}else{
	echo '{"sql":"' . $sql . '","result":"N"}';
}

//输出压缩成果
ob_end_flush();

?>